﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ThePingMasterConfiguration.Commands;
using ThePingMasterConfiguration.ViewModels;

namespace ThePingMasterConfiguration.Services
{
    public class EnterAddressService : IEnterAddressService
    {
        private readonly ICommandFactory _factory;

        public EnterAddressService(ICommandFactory factory)
        {
            if (factory == null) throw new ArgumentNullException("factory");
            _factory = factory;
        }

        public string GetAddress()
        {
            string address = null;
            AddressModel model = new AddressModel("", _factory);
            EnterAddressWindow dialog = new EnterAddressWindow(model);
            bool? result = dialog.ShowDialog();
            if (result.HasValue && result.Value == true)
            {
                address = model.Address;
            }
            return address;
        }
    }
}
